package com.guaoran.interview.demo.dao;

import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @Author gucheng
 * @Description
 *  测试
 * 2019-04-02 14:15
 */
@Component
public class DemoDao {
    public volatile AtomicLong atomicLong = new AtomicLong();
    // 自增
    public Long incr(){
        return atomicLong.incrementAndGet();
    }
    // 自减
    public Long decr(){
        return atomicLong.decrementAndGet();
    }
    // 获得值
    public Long get(){
        return atomicLong.get();
    }
}